import Vue from "vue";

import {
  Button,
  Field,
  Notify,
  NavBar,
  PullRefresh,
  Progress,
  Cell,
  CellGroup,
  List,
  Image,
  Lazyload,
  Icon,
  Tag,
  DropdownMenu,
  DropdownItem,
  Sticky,
  Popup,
  Swipe,
  SwipeItem,
  Toast,
  Dialog,
  ImagePreview,
  Picker,
  Uploader,
  DatetimePicker,
  Checkbox,
  Overlay,
  Tabbar,
  TabbarItem,
  Form,
  Badge,
  RadioGroup,
  Radio,
  Search,
  ActionSheet,
  Tab,
  Tabs
} from "vant";

Vue.use(Button)
  .use(Toast)
  .use(Popup)
  .use(Progress)
  .use(Cell)
  .use(CellGroup)
  .use(Image)
  .use(Lazyload)
  .use(List)
  .use(Tag)
  .use(DropdownMenu)
  .use(Swipe)
  .use(SwipeItem)
  .use(DropdownItem)
  .use(Sticky)
  .use(Icon)
  .use(Field)
  .use(Notify)
  .use(NavBar)
  .use(PullRefresh)
  .use(Dialog)
  .use(Picker)
  .use(Uploader)
  .use(DatetimePicker)
  .use(ImagePreview)
  .use(Checkbox)
  .use(Overlay)
  .use(Tabbar)
  .use(TabbarItem)
  .use(Form)
  .use(Badge)
  .use(RadioGroup)
  .use(Radio)
  .use(ActionSheet)
  .use(Search)
  .use(Tab)
  .use(Tabs);

Vue.prototype.$Dialog = Dialog;
Vue.prototype.$Toast = Toast;
Vue.prototype.showLoading = (text = "") => {
  Toast.loading({
    forbidClick: true,
    message: text,
    duration: 0
  });
};
